// 专门处理权限路由的模块
import { constantRoutes, asyncRoutes } from '@/router'
const state = {
   routes: constantRoutes
}
const mutations = {
   setRoutes(state, newRoutes) {
      state.routes = [...constantRoutes, ...newRoutes]
   }
}
const actions = {
   filterRoutes(context, menus) {
      let routes = asyncRoutes.filter(item => menus.includes(item.name))
      context.commit('setRoutes', routes)
      return routes
   }
}

export default {
   namespaced: true,
   state,
   mutations,
   actions
}